|
![](/i/fill.gif) |
Chris Huff <chr### [at] yahoo com> wrote:
: There is a #break statement for switch statements, and from the
: description, it doesn't seem like it would be too difficult to extend to
: #if statments and loops.
The #break-statement should NOT jump out of the current #if-statement, but
only out of the current #while-statement (and whatever else loop statement
this enhanced language would have).
Why?
Because usually you do this:
#while(whatever)
...
#if(ending_condition)
#break
#end
...
#end
It's obvious that if the #break just jumps out of the #if-statement, it
will be mostly useless.
Unless...
... you could specify how many blocks do the #break jump out of. For
example:
#while(cond1)
#while(cond2)
#while(cond3)
#if(cond4)
#break(3)
#end
#end
#end
...
#end
Supposing that the #break also jumps out of the current #if-statement (and
it's counted as one block), the #break in this code will jump to the line
after the second last #end (ie. the line after the #while(cond2)-block,
marked with "...").
Of course a simple #break that just jumps out of the current loop would be
mostly enough.
: Maybe even macros(have you ever wanted to jump
: out of a macro early?)
I don't know how this could be done. As far as I know, #macro is just
a text-replacement command. The macro call is just replaced with the body
of the macro with the parameters changed to their proper values.
If you would #break a macro, it would mean that the body will literally be
broken, ie. with missing #end-statements (probably from the #if inside which
the #break was) thus causing problems to the parser.
If macros were more like function calls, it would be more easier to add
a #return-statement.
Now, that's an idea:
#function Abs(x)
#if(x>=0)
#return x
#else
#return -x
#end
#end
Hmm... Does this make sense? :)
--
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Post a reply to this message
|
![](/i/fill.gif) |